package BogoLogger;

my $filepath = "bogoclientlog.txt";
my $verboselvl;
my $issetupdone = 0;

sub setlog{
	shift;
	if($issetupdone == 1)
	{
		return -1;
	}
	$filepath = shift;
	print $filepath."\n";
	$verboselvl = shift;
	print $verboselvl."\n";
	$issetupdone = 1;
	return 0;
}

sub msg{
	shift;
	my $vlvl = shift;
	my $modulename = shift;
	my $msg = shift;
	if(defined($msg))
	{
		print "message:".$msg;
		if($vlvl >= $verboselvl)
		{
		
			open(FD,">>$filepath") or die "Open logfile err $!";
			print FD "->".join(' ',localtime(time))."|".$modulename." : ".$msg?$msg:"\n";
			close(FD);
		}
	}
	
}


1;